﻿using System;
using System.Web.UI;
using Bingosoft.Web.Utils;
using HHMMS.Core.Service;
using HHMMS.Core.Model;

namespace HHMMS.UI.Modules.PlanManager
{
    public partial class PartsDiscardRecordEdit : Page
    {
        private readonly PartsDiscardService _partsDiscardService = ObjectHelper.GetObject<PartsDiscardService>();

        protected void Page_Load(object sender, EventArgs e)
        {            
            if (!IsPostBack && SmartForm.IsEdit())
            {
                SmartForm.Fill(container, "PlanManager.PartsDiscardRecord.Get");
            }
        }
        
        protected void SaveOrUpdatePartsDiscardRecord(object sender, EventArgs e)
        {
            PartsDiscardRecord partsDiscardRecord = SmartForm.GetEntity<PartsDiscardRecord>(container);
            this._partsDiscardService.SaveOrUpdatePartsDiscardRecord(partsDiscardRecord);

            ScriptHelper.CloseDialog(this, "true");
        }
    }
}